package com.vcg.java.demo;

import org.apache.commons.io.IOUtils;
import org.junit.Test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

/**
 * Created by wuyu on 2016/8/10.
 */
public class TestUrlConnection {

    @Test
    public void testUrlConnection() throws IOException {
        URL url = new URL("http", "127.0.0.1", 8080, "/lib?jar=ascsapjco3wrp-20100529.jar");
        URLConnection urlConnection = url.openConnection();
        InputStream inputStream = urlConnection.getInputStream();
        IOUtils.copy(inputStream,new FileOutputStream("g:/test.jar"));
    }
}
